﻿Imports BUS
Imports DTO

Public Class frmxlcapnhatchucvu

    Private Sub btnthoat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnthoat.Click
        Me.Close()
    End Sub

    Private _maChucVu As Integer
    Public Property MaChucVu() As Integer
        Get
            Return _maChucVu
        End Get
        Set(ByVal value As Integer)
            _maChucVu = value
        End Set
    End Property
    Private _tenChucVu As String
    Public Property TenChucVu() As String
        Get
            Return _tenChucVu
        End Get
        Set(ByVal value As String)
            _tenChucVu = value
        End Set
    End Property
    Private Sub frmxlcapnhatchucvu_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub btnchapnhan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnchapnhan.Click
        If txttenchucvu.Text <> "" Then
            Dim sql As String = "Update CHUCVU Set TenChucVu=" + "'" + txttenchucvu.Text + "'" + " Where MaChucVu=" + _maChucVu.ToString()
            Dim bus As New ChucVuBUS()
            Dim kq As Integer = bus.CapNhatChuVu(sql)
            If kq = 1 Then
                MessageBox.Show("Câp nhật thành công !")
                Me.Close()
            Else
                MessageBox.Show("Cập nhật thất bại !")
            End If
        Else
            MessageBox.Show("Nhập tên chức vụ !")
        End If
    End Sub
End Class